#include <iostream>
#include <vector>
#include <unistd.h>
#include <ctime>

#include "Thread.hpp"
#include "threadpool.hpp"
#include "Task.hpp"

int main()
{
    Task t1(1,2);
    Task t2(2,2);
    Task t3(3,2);
    Task t4(1,6);
    Task t5(7,2);
    std::vector<Task> vt{t1, t2, t3, t4 ,t5};

    for(auto& e : vt)
    {
        ThreadPool<Task>::GetInstance()->Equeue(e);
    }

    srand(time(nullptr));

    int cnt = 10;
    while(cnt)
    {  
        int x = rand() % 10 + 1;
        int y = rand() % 7 + 1;
        Task tmp(x, y);
        ThreadPool<Task>::GetInstance()->Equeue(tmp);

        sleep(1);
    }

    ThreadPool<Task>::GetInstance()->Stop();
    return 0;
}